1. Field of the Invention
The invention relates to a method of processing an image. More particularly, the invention relates to a method of labeling connected components in an image and a computer system using the method.
2. Description of Related Art
In the field of image processing, the algorithm of labeling connected components is a technique capable of identifying data of the same block among scattered data by utilizing the computer system. In other words, an image may include a plurality of object blocks and the algorithm of labeling connected components identifies connected pixels in the image after scanning so as to distinguish each object block. The identification result generated therefrom can then be provided to other systems. For instance, before processing other operations, a visual tracking system and a visual identifying system both require the algorithm of labeling connected components to pre-process the image.
In the conventional algorithm of labeling connected components, pixels of the same object block in the image may be temporarily labeled with different labels during the labeling process. Consequently, the image has to be scanned repetitively and an equivalent process has to be performed on the labels in order to reflect the actual state of the image patterns. That is, the algorithm of labeling connected components must scan the image repetitively until the label value does not change anymore.
Accordingly, whether adopting methods such as the recursive method or the pixel searching method, the conventional algorithm of labeling connected components still requires high time complexity to complete the processing. Thus, in practice, the conventional algorithm of labeling connected components is mostly adopted in back-end processes or non-real time systems because its performance is not satisfied with the demands of most real-time systems.